/****************************************************************************

	COPYRIGHT(C) MAXSI SOFTWARE, JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010

    This file is part of Maxsi Engine.

    Maxsi Engine is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Maxsi Engine is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	*/ #include "MaxsiEngineContributors.h" /*

	If you modify this file, please enter your name below and provide contact
	information in MaxsiEngineContributors.h. For more information please see
	MaxsiEngineContributors.h.
	
	Contributors to this file:

	- Jonas 'Sortie' Termansen
	- [your name here]

	MaxsiEngine.dll
	A linkable version of Maxsi Engine

	MaxsiDefines.h
	General defines

****************************************************************************/

#ifndef MaxsiDefines_H
#define MaxsiDefines_H

	// Maxsi Engine

	namespace MaxsiEngine{};

	#define MaxsiEngine_VersionInfo "Application/x-MaxsiEngine/" MaxsiEngine_Branch "/" MaxsiEngine_Version "/" __DATE__

	#ifdef __MINGW_H // Hacks to make Maxsi Engine compile using MinGW

		#define __forceinline //inline
		#define _CVTBUFSIZE (309+40) // Number of digits in maximum double precision value + slop
		#define __debugbreak() // We haven't gotten debugging working here yet, so just ignore all this
		#define __noop()

		#ifdef __MSVCRT_VERSION__
		#undef __MSVCRT_VERSION__
		#endif
		#define __MSVCRT_VERSION__ 0x0601

		#if __STDC_VERSION__ < 199901L
			#if __GNUC__ >= 2
				#define __func__ __FUNCTION__
			#else
				#define __func__ "<unknown>"
			#endif
		#endif

		#define THREADED_VARIABLE __thread

	#else

		#define THREADED_VARIABLE __declspec( thread )

	#endif

	typedef bool (__cdecl* ProgressFunc_Type)(int);
	typedef	unsigned long IP;
	#if NDEBUG
	#define REMOVEME(Code)	Outdated_Debug_Code();
	#define TODO(What_To_Do,Code) _TODO();
	#define TODOFAIL() _TODO();
	#else
	#define REMOVEME(Code)	Code
	#define TODO(What_To_Do,Code) Code
	#define TODOFAIL()
	#endif

	#define No(Statement)	!(Statement)
	#define Not(Statement)	!(Statement)
 
	#define Declare_Class(Child,Parent) typedef Parent BaseClass;
	#define Declare_Class_NoBase(Child)
	#define	ME_DECLARE_COMPONENT(Name, Class, Parent) Declare_Class(Class,Parent);
	#define	ME_DECLARE_ABSTRACT_COMPONENT(Class, Parent) Declare_Class(Class,Parent);

	#define	SupportId(Id) "ErrorID: ME" #Id ", see www.maxsi.dk/support/ for more information."

#ifndef assert
	#define assert(ignore)((void) 0)
#endif

	struct MEVariable
	{
		unsigned	char	NameSize;
		unsigned	int		DataSize;
		char*				VariableData;
	};


	// Maxsi UI
	namespace MaxsiUI{};

#define		ME_ERROR_SUCCESS			0
#define		ME_ERROR_OUTOFMEM			1
#define		ME_ERROR_MEMALLOCFAIL		2
#define		ME_ERROR_ACCESS_VIOLATION	3
#define		ME_ERROR_NOT_INITIALIZED	4
#define		ME_ERROR_IS_IN_USE			5

#define IFDEL(Pointer) if ( Pointer ) { delete[] Pointer; Pointer = NULL; }
#define IFDELSINGLE(Pointer) if ( Pointer ) { delete Pointer; Pointer = NULL; }
#define IFDELARRRAY(Pointer) if ( Pointer ) { delete[] Pointer; Pointer = NULL; }


#endif